package cn.rui.controller;

import cn.rui.pojo.Permissions;
import cn.rui.service.PermService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 徽州大都督
 * @date 2020/8/13
 */
@RestController
@RequestMapping("perm")
public class PermController {

    @Autowired
    private PermService permService;

    /**
     * 查询所有管理员
     */
    @GetMapping("findAll")
    public List<Permissions> findAll(){
        return permService.findAll();
    }

    /**
     * 根据id查询
     */
    @GetMapping("findByPid/{pid}")
    public Permissions findByPid(@PathVariable("pid")Integer pid){
        return permService.findByPid(pid);
    }
}
